Repository navigation
fix(folders): don't send "None" as the folder description - #212
Conversation
create_folder() put f"{description}" into the folderDescription
header, so a folder created without a description was stored with
the literal description "None". Only send the header when a
description is given, and add a mocked test for it.
Signed-off-by: 72004 <syahra2014@gmail.com>
Assisted-by: Claude
| assert f"Unable to get a list of folders for {foss.user.name}" in str(excinfo.value) | ||
|
|
||
|
|
||
| def _offline_foss(url: str) -> Fossology: |
There was a problem hiding this comment.
For change in the API logic - not just the expected responses - we need a real test against a locally running Fossology instance.
The testsuite covers this when using the fixture foss like in other tests.
The test should be successful against a "real" Fossology instance, not an offline one.
There was a problem hiding this comment.
Thanks, that makes sense. In 976d2b5 I replaced the mocked test with test_create_folder_without_description(foss), which uses the foss fixture. It creates a folder without a description on a running server, checks that the stored description is "", and deletes the folder.
I ran tests/test_folders.py against fossology/fossology:4.7.1 (the CI image) in Docker. All 15 tests pass with the fix. Without it, the new test fails with assert 'None' == ''.
Replace the mocked test with one that uses the foss fixture, so the description stored by a running Fossology server is checked. It fails without the fix (the description is stored as 'None'). Assisted-by: Claude Signed-off-by: 72004 <syahra2014@gmail.com>
|
@syahra712 the testsuite throws an error, can you please have a look at it and provide a fix? Thanks! |
secrets.randbelow(192) can pick the id of an upload created earlier in the run, so the 'does not exist' test sometimes got a real upload back. Signed-off-by: 72004 <syahra2014@gmail.com> Assisted-by: Claude
|
@deveaud-m The failure is I pushed a small fix in this PR: both "does not exist" permission tests now use ids from 1,000,000 up. Happy to split it into its own PR if you prefer. |
When
create_folder()is called without a description, it sendsfolderDescription: Noneas a string, so the new folder gets the description "None". With this fix the header is only sent when a description is given. I added a test that runs against a real Fossology instance through thefossfixture. It fails on main (the description is stored as "None").AI-assisted (Claude). I reviewed the code and ran the tests.